package com.ruoyi.service.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.service.domain.ServiceMsginfo;
import com.ruoyi.service.service.IServiceMsginfoService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 模板信息表Controller
 * 
 * @author ZDL
 * @date 2025-03-04
 */
@RestController
@RequestMapping("/service/msginfo")
public class ServiceMsginfoController extends BaseController
{
    @Autowired
    private IServiceMsginfoService serviceMsginfoService;

    /**
     * 查询模板信息表列表
     */
    @PreAuthorize("@ss.hasPermi('service:msginfo:list')")
    @GetMapping("/list")
    public TableDataInfo list(ServiceMsginfo serviceMsginfo)
    {
        startPage();
        List<ServiceMsginfo> list = serviceMsginfoService.selectServiceMsginfoList(serviceMsginfo);
        return getDataTable(list);
    }

    /**
     * 导出模板信息表列表
     */
    @PreAuthorize("@ss.hasPermi('service:msginfo:export')")
    @Log(title = "模板信息表", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ServiceMsginfo serviceMsginfo)
    {
        List<ServiceMsginfo> list = serviceMsginfoService.selectServiceMsginfoList(serviceMsginfo);
        ExcelUtil<ServiceMsginfo> util = new ExcelUtil<ServiceMsginfo>(ServiceMsginfo.class);
        util.exportExcel(response, list, "模板信息表数据");
    }

    /**
     * 获取模板信息表详细信息
     */
    @PreAuthorize("@ss.hasPermi('service:msginfo:query')")
    @GetMapping(value = "/{msginfoId}")
    public AjaxResult getInfo(@PathVariable("msginfoId") Long msginfoId)
    {
        return success(serviceMsginfoService.selectServiceMsginfoByMsginfoId(msginfoId));
    }

    /**
     * 新增模板信息表
     */
    @PreAuthorize("@ss.hasPermi('service:msginfo:add')")
    @Log(title = "模板信息表", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ServiceMsginfo serviceMsginfo)
    {
        return toAjax(serviceMsginfoService.insertServiceMsginfo(serviceMsginfo));
    }

    /**
     * 修改模板信息表
     */
    @PreAuthorize("@ss.hasPermi('service:msginfo:edit')")
    @Log(title = "模板信息表", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ServiceMsginfo serviceMsginfo)
    {
        return toAjax(serviceMsginfoService.updateServiceMsginfo(serviceMsginfo));
    }

    /**
     * 删除模板信息表
     */
    @PreAuthorize("@ss.hasPermi('service:msginfo:remove')")
    @Log(title = "模板信息表", businessType = BusinessType.DELETE)
	@DeleteMapping("/{msginfoIds}")
    public AjaxResult remove(@PathVariable Long[] msginfoIds)
    {
        return toAjax(serviceMsginfoService.deleteServiceMsginfoByMsginfoIds(msginfoIds));
    }
}
